package org.rugby.online.impl;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;
import org.rugby.online.core.environment.RboTool;
import org.rugby.online.core.environment.RboToolStatus;
import org.rugby.online.core.skills.RboSkillType;
import org.rugby.online.impl.DefaultSkill;
import org.rugby.online.impl.DefaultTool;

public class DefaultToolTest {

	/**
	 * Tool for test
	 */
	private RboTool tool; 
	
	@Before
	public void setUp() throws Exception {
		tool = new TestTool();
	}

	@Test
	public void testGetAssociatedSkill() {
		assertTrue(tool.getAssociatedSkill().getType().equals(RboSkillType.TRAINER_ASSISTANT_BACKWARDS_PASS));
	}

	@Test
	public void testGetBuyPrice() {
		assertTrue(tool.getBuyPrice() == 100);
	}

	@Test
	public void testGetSellPrice() {
		assertTrue(tool.getSellPrice() == 50);
	}

	@Test
	public void testGetRepairPrice() {
		assertTrue(tool.getRepairPrice() == 20);
	}

	@Test
	public void testGetStatus() {
		assertTrue(tool.getStatus().equals(RboToolStatus.NEW));
	}

	@Test
	public void testGetName() {
		assertTrue(tool.getName().equals("TOOL TEST"));
	}

	@Test
	public void testGetId() {
		assertNotNull(tool.getId());
	}
	
	private class TestTool extends DefaultTool {
		
		/**
		 * Serial
		 */
		private static final long serialVersionUID = 1L;

		public TestTool() {
			super();
			this.buyPrice = 100;
			this.repairPrice = 20;
			this.sellPrice = 50;
			this.skill = new DefaultSkill(RboSkillType.TRAINER_ASSISTANT_BACKWARDS_PASS);
			this.status = RboToolStatus.NEW;
			this.setName("TOOL TEST");
		}
		
	}

}
